<template>
  <div>
    <div class="product-content">
      <el-form size="small" ref="form" :model="form" label-width="150px">
        <!--基础设置-->
        <Product v-if="assemble_activity_id" :activity_id="assemble_activity_id" :form="form" type="edit"></Product>
      </el-form>
    </div>
    <!--提交-->
    
  </div>
</template>
<script>
import AssembleApi from '@/api/assemble.js';
import Product from './part/Product.vue';
export default {
  components: {
    /*基础设置*/
    Product
  },
  data() {
    return {
      form: {
        /*商品源数据*/
        tableData: [],
        totalDataNumber:0
      },
      assemble_activity_id:null,
      /*判断是否正在加载*/
      loading: false,
    };
  },
  created() {
    this.assemble_activity_id = this.$route.query.assemble_activity_id;
    this.listProduct(this.assemble_activity_id);
  },

  methods: {
    /*取消*/
    cancelFunc() {
      this.$router.back(-1);
    },
    listProduct(assemble_activity_id){
      AssembleApi.selectProduct({
              assemble_activity_id: assemble_activity_id
            }, true)
            .then(data => {
              if (data.code == 1) {
                
                self.loading = false;
                self.form.tableData = data.data.list.data;
                self.form.totalDataNumber = data.data.list.total;
                
              } else {
                self.$message.error('错了哦，这是一条错误消息');
              }
            })
            .catch(error => {

            });
    }
  }
};
</script>
